{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "true"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "IPythonDisplay.display == display"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "* a\n",
       "* b\n",
       "\n",
       "https://ipython.org/ipython-doc/dev/api/generated/IPython.display.html\n",
       "\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "IPythonDisplay.display(IJulia.text_markdown, \"\"\"\n",
    "* a\n",
    "* b\n",
    "\n",
    "https://ipython.org/ipython-doc/dev/api/generated/IPython.display.html\n",
    "\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"210px\" height=\"142px\" viewBox=\"0 0 310 216\" enable-background=\"new 0 0 310 216\" xml:space=\"preserve\">\n",
       "\n",
       "<!-- blue dot -->\n",
       "<circle fill=\"#6b85dd\" stroke=\"#4266d5\" stroke-width=\"3\" cx=\"50.5\" cy=\"60\" r=\"16.5\"></circle>\n",
       "<!-- red dot -->\n",
       "<circle fill=\"#d66661\" stroke=\"#c93d39\" stroke-width=\"3\" cx=\"212.459\" cy=\"60\" r=\"16.5\"></circle>\n",
       "<!-- green dot -->\n",
       "<circle fill=\"#6bab5b\" stroke=\"#3b972e\" stroke-width=\"3\" cx=\"233.834\" cy=\"23.874\" r=\"16.5\"></circle>\n",
       "<!-- purple dot -->\n",
       "<circle fill=\"#aa7dc0\" stroke=\"#945bb0\" stroke-width=\"3\" cx=\"255.209\" cy=\"60\" r=\"16.5\"></circle>\n",
       "\n",
       "<!-- \"j\" -->\n",
       "<path fill=\"#252525\" d=\"M37.216,138.427c0-15.839,0.006-31.679-0.018-47.517c-0.001-0.827,0.169-1.234,1.043-1.47\n",
       "\tc7.876-2.127,15.739-4.308,23.606-6.47c1.33-0.366,1.333-0.36,1.333,1.019c0,25.758,0.015,51.517-0.012,77.274\n",
       "\tc-0.006,5.514,0.245,11.032-0.272,16.543c-0.628,6.69-2.15,13.092-6.438,18.506c-3.781,4.771-8.898,7.25-14.767,8.338\n",
       "\tc-6.599,1.222-13.251,1.552-19.934,0.938c-4.616-0.423-9.045-1.486-12.844-4.363c-2.863-2.168-4.454-4.935-3.745-8.603\n",
       "\tc0.736-3.806,3.348-5.978,6.861-7.127c2.262-0.74,4.628-0.872,6.994-0.53c1.823,0.264,3.42,1.023,4.779,2.288\n",
       "\tc1.38,1.284,2.641,2.674,3.778,4.177c0.872,1.15,1.793,2.256,2.991,3.086c2.055,1.426,4,0.965,5.213-1.216\n",
       "\tc0.819-1.473,0.997-3.106,1.173-4.731c0.255-2.348,0.255-4.707,0.256-7.062C37.218,167.145,37.216,152.786,37.216,138.427z\"></path>\n",
       "\n",
       "<!-- \"u\" -->\n",
       "<path fill=\"#252525\" d=\"M125.536,162.479c-2.908,2.385-5.783,4.312-8.88,5.904c-10.348,5.323-20.514,4.521-30.324-1.253\n",
       "\tc-6.71-3.95-11.012-9.849-12.52-17.606c-0.236-1.213-0.363-2.438-0.363-3.688c0.01-19.797,0.017-39.593-0.02-59.39\n",
       "\tc-0.002-1.102,0.285-1.357,1.363-1.351c7.798,0.049,15.597,0.044,23.396,0.003c0.95-0.005,1.177,0.25,1.175,1.183\n",
       "\tc-0.027,19.356-0.025,38.713-0.018,58.07c0.002,6.34,3.599,10.934,9.672,12.42c2.13,0.521,4.19,0.396,6.173-0.6\n",
       "\tc4.26-2.139,7.457-5.427,10.116-9.307c0.333-0.487,0.224-1,0.224-1.51c0.007-19.635,0.016-39.271-0.02-58.904\n",
       "\tc-0.002-1.083,0.255-1.369,1.353-1.361c7.838,0.052,15.677,0.045,23.515,0.004c0.916-0.005,1.103,0.244,1.102,1.124\n",
       "\tc-0.025,27.677-0.026,55.353,0.002,83.024c0.001,0.938-0.278,1.099-1.139,1.095c-7.918-0.028-15.837-0.028-23.756-0.001\n",
       "\tc-0.815,0.003-1.1-0.166-1.073-1.037C125.581,167.117,125.536,164.928,125.536,162.479z\"></path>\n",
       "\n",
       "<!-- \"l\" -->\n",
       "<path fill=\"#252525\" d=\"M187.423,107.08c0,20.637-0.011,41.273,0.026,61.91c0.003,1.119-0.309,1.361-1.381,1.355\n",
       "\tc-7.799-0.052-15.598-0.047-23.396-0.008c-0.898,0.008-1.117-0.222-1.115-1.115c0.021-39.074,0.021-78.147,0-117.226\n",
       "\tc0-0.811,0.189-1.169,1.006-1.392c7.871-2.149,15.73-4.327,23.584-6.545c1.045-0.295,1.308-0.17,1.306,0.985\n",
       "\tC187.412,65.727,187.423,86.403,187.423,107.08z\"></path>\n",
       "\n",
       "<!-- \"i\" -->\n",
       "<path fill=\"#252525\" d=\"M223.46,126.477c0,14.155-0.011,28.312,0.021,42.467c0.002,1.027-0.164,1.418-1.332,1.408\n",
       "\tc-7.838-0.061-15.676-0.047-23.516-0.01c-0.881,0.004-1.121-0.189-1.119-1.104c0.026-26.153,0.025-52.307,0-78.458\n",
       "\tc0-0.776,0.203-1.101,0.941-1.302c7.984-2.172,15.972-4.35,23.938-6.596c1.049-0.296,1.08,0.031,1.078,0.886\n",
       "\tC223.454,98.004,223.46,112.239,223.46,126.477z\"></path>\n",
       "\n",
       "<!-- \"a\" -->\n",
       "<path fill=\"#252525\" d=\"M277.695,163.6c-0.786,0.646-1.404,1.125-2,1.635c-4.375,3.746-9.42,5.898-15.16,6.42\n",
       "\tc-5.792,0.527-11.479,0.244-16.934-2.047c-12.08-5.071-15.554-17.188-11.938-27.448c1.799-5.111,5.472-8.868,9.831-11.94\n",
       "\tc5.681-4.003,12.009-6.732,18.504-9.074c5.576-2.014,11.186-3.939,16.955-5.347c0.445-0.104,0.773-0.243,0.757-0.854\n",
       "\tc-0.136-4.389,0.261-8.79-0.479-13.165c-1.225-7.209-6.617-10.013-12.895-9.348c-0.516,0.055-1.029,0.129-1.536,0.241\n",
       "\tc-4.877,1.081-7.312,4.413-7.374,10.127c-0.02,1.729-0.229,3.418-0.693,5.084c-0.906,3.229-2.969,5.354-6.168,6.266\n",
       "\tc-3.422,0.979-6.893,0.998-10.23-0.305c-6.529-2.543-8.877-10.164-5.12-16.512c2.249-3.799,5.606-6.4,9.461-8.405\n",
       "\tc6.238-3.246,12.914-4.974,19.896-5.537c7.565-0.61,15.096-0.366,22.49,1.507c4.285,1.085,8.312,2.776,11.744,5.657\n",
       "\tc4.473,3.749,6.776,8.647,6.812,14.374c0.139,21.477,0.096,42.951,0.143,64.428c0.002,0.799-0.248,0.983-1.021,0.98\n",
       "\tc-8.035-0.025-16.074-0.023-24.113-0.001c-0.716,0.002-0.973-0.146-0.941-0.915C277.736,167.562,277.695,165.698,277.695,163.6z\n",
       "\t M277.695,126.393c-4.793,2.104-9.25,4.373-13.287,7.408c-2.151,1.618-4.033,3.483-5.732,5.581\n",
       "\tc-4.229,5.226-1.988,13.343,1.693,16.599c1.592,1.406,3.359,1.906,5.419,1.521c1.621-0.307,3.149-0.857,4.549-1.734\n",
       "\tc1.521-0.951,2.949-2.072,4.539-2.887c2.31-1.18,2.97-2.861,2.894-5.445C277.561,140.484,277.695,133.527,277.695,126.393z\"></path>\n",
       "\n",
       "</svg>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "IPythonDisplay.display(IJulia.image_svg, \"\"\"\n",
    "<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"210px\" height=\"142px\" viewBox=\"0 0 310 216\" enable-background=\"new 0 0 310 216\" xml:space=\"preserve\">\n",
    "\n",
    "<!-- blue dot -->\n",
    "<circle fill=\"#6b85dd\" stroke=\"#4266d5\" stroke-width=\"3\" cx=\"50.5\" cy=\"60\" r=\"16.5\"></circle>\n",
    "<!-- red dot -->\n",
    "<circle fill=\"#d66661\" stroke=\"#c93d39\" stroke-width=\"3\" cx=\"212.459\" cy=\"60\" r=\"16.5\"></circle>\n",
    "<!-- green dot -->\n",
    "<circle fill=\"#6bab5b\" stroke=\"#3b972e\" stroke-width=\"3\" cx=\"233.834\" cy=\"23.874\" r=\"16.5\"></circle>\n",
    "<!-- purple dot -->\n",
    "<circle fill=\"#aa7dc0\" stroke=\"#945bb0\" stroke-width=\"3\" cx=\"255.209\" cy=\"60\" r=\"16.5\"></circle>\n",
    "\n",
    "<!-- \"j\" -->\n",
    "<path fill=\"#252525\" d=\"M37.216,138.427c0-15.839,0.006-31.679-0.018-47.517c-0.001-0.827,0.169-1.234,1.043-1.47\n",
    "\tc7.876-2.127,15.739-4.308,23.606-6.47c1.33-0.366,1.333-0.36,1.333,1.019c0,25.758,0.015,51.517-0.012,77.274\n",
    "\tc-0.006,5.514,0.245,11.032-0.272,16.543c-0.628,6.69-2.15,13.092-6.438,18.506c-3.781,4.771-8.898,7.25-14.767,8.338\n",
    "\tc-6.599,1.222-13.251,1.552-19.934,0.938c-4.616-0.423-9.045-1.486-12.844-4.363c-2.863-2.168-4.454-4.935-3.745-8.603\n",
    "\tc0.736-3.806,3.348-5.978,6.861-7.127c2.262-0.74,4.628-0.872,6.994-0.53c1.823,0.264,3.42,1.023,4.779,2.288\n",
    "\tc1.38,1.284,2.641,2.674,3.778,4.177c0.872,1.15,1.793,2.256,2.991,3.086c2.055,1.426,4,0.965,5.213-1.216\n",
    "\tc0.819-1.473,0.997-3.106,1.173-4.731c0.255-2.348,0.255-4.707,0.256-7.062C37.218,167.145,37.216,152.786,37.216,138.427z\"></path>\n",
    "\n",
    "<!-- \"u\" -->\n",
    "<path fill=\"#252525\" d=\"M125.536,162.479c-2.908,2.385-5.783,4.312-8.88,5.904c-10.348,5.323-20.514,4.521-30.324-1.253\n",
    "\tc-6.71-3.95-11.012-9.849-12.52-17.606c-0.236-1.213-0.363-2.438-0.363-3.688c0.01-19.797,0.017-39.593-0.02-59.39\n",
    "\tc-0.002-1.102,0.285-1.357,1.363-1.351c7.798,0.049,15.597,0.044,23.396,0.003c0.95-0.005,1.177,0.25,1.175,1.183\n",
    "\tc-0.027,19.356-0.025,38.713-0.018,58.07c0.002,6.34,3.599,10.934,9.672,12.42c2.13,0.521,4.19,0.396,6.173-0.6\n",
    "\tc4.26-2.139,7.457-5.427,10.116-9.307c0.333-0.487,0.224-1,0.224-1.51c0.007-19.635,0.016-39.271-0.02-58.904\n",
    "\tc-0.002-1.083,0.255-1.369,1.353-1.361c7.838,0.052,15.677,0.045,23.515,0.004c0.916-0.005,1.103,0.244,1.102,1.124\n",
    "\tc-0.025,27.677-0.026,55.353,0.002,83.024c0.001,0.938-0.278,1.099-1.139,1.095c-7.918-0.028-15.837-0.028-23.756-0.001\n",
    "\tc-0.815,0.003-1.1-0.166-1.073-1.037C125.581,167.117,125.536,164.928,125.536,162.479z\"></path>\n",
    "\n",
    "<!-- \"l\" -->\n",
    "<path fill=\"#252525\" d=\"M187.423,107.08c0,20.637-0.011,41.273,0.026,61.91c0.003,1.119-0.309,1.361-1.381,1.355\n",
    "\tc-7.799-0.052-15.598-0.047-23.396-0.008c-0.898,0.008-1.117-0.222-1.115-1.115c0.021-39.074,0.021-78.147,0-117.226\n",
    "\tc0-0.811,0.189-1.169,1.006-1.392c7.871-2.149,15.73-4.327,23.584-6.545c1.045-0.295,1.308-0.17,1.306,0.985\n",
    "\tC187.412,65.727,187.423,86.403,187.423,107.08z\"></path>\n",
    "\n",
    "<!-- \"i\" -->\n",
    "<path fill=\"#252525\" d=\"M223.46,126.477c0,14.155-0.011,28.312,0.021,42.467c0.002,1.027-0.164,1.418-1.332,1.408\n",
    "\tc-7.838-0.061-15.676-0.047-23.516-0.01c-0.881,0.004-1.121-0.189-1.119-1.104c0.026-26.153,0.025-52.307,0-78.458\n",
    "\tc0-0.776,0.203-1.101,0.941-1.302c7.984-2.172,15.972-4.35,23.938-6.596c1.049-0.296,1.08,0.031,1.078,0.886\n",
    "\tC223.454,98.004,223.46,112.239,223.46,126.477z\"></path>\n",
    "\n",
    "<!-- \"a\" -->\n",
    "<path fill=\"#252525\" d=\"M277.695,163.6c-0.786,0.646-1.404,1.125-2,1.635c-4.375,3.746-9.42,5.898-15.16,6.42\n",
    "\tc-5.792,0.527-11.479,0.244-16.934-2.047c-12.08-5.071-15.554-17.188-11.938-27.448c1.799-5.111,5.472-8.868,9.831-11.94\n",
    "\tc5.681-4.003,12.009-6.732,18.504-9.074c5.576-2.014,11.186-3.939,16.955-5.347c0.445-0.104,0.773-0.243,0.757-0.854\n",
    "\tc-0.136-4.389,0.261-8.79-0.479-13.165c-1.225-7.209-6.617-10.013-12.895-9.348c-0.516,0.055-1.029,0.129-1.536,0.241\n",
    "\tc-4.877,1.081-7.312,4.413-7.374,10.127c-0.02,1.729-0.229,3.418-0.693,5.084c-0.906,3.229-2.969,5.354-6.168,6.266\n",
    "\tc-3.422,0.979-6.893,0.998-10.23-0.305c-6.529-2.543-8.877-10.164-5.12-16.512c2.249-3.799,5.606-6.4,9.461-8.405\n",
    "\tc6.238-3.246,12.914-4.974,19.896-5.537c7.565-0.61,15.096-0.366,22.49,1.507c4.285,1.085,8.312,2.776,11.744,5.657\n",
    "\tc4.473,3.749,6.776,8.647,6.812,14.374c0.139,21.477,0.096,42.951,0.143,64.428c0.002,0.799-0.248,0.983-1.021,0.98\n",
    "\tc-8.035-0.025-16.074-0.023-24.113-0.001c-0.716,0.002-0.973-0.146-0.941-0.915C277.736,167.562,277.695,165.698,277.695,163.6z\n",
    "\t M277.695,126.393c-4.793,2.104-9.25,4.373-13.287,7.408c-2.151,1.618-4.033,3.483-5.732,5.581\n",
    "\tc-4.229,5.226-1.988,13.343,1.693,16.599c1.592,1.406,3.359,1.906,5.419,1.521c1.621-0.307,3.149-0.857,4.549-1.734\n",
    "\tc1.521-0.951,2.949-2.072,4.539-2.887c2.31-1.18,2.97-2.861,2.894-5.445C277.561,140.484,277.695,133.527,277.695,126.393z\"></path>\n",
    "\n",
    "</svg>\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](http://julialang.org/images/ijulia.png \"IJulia\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MIME type image/png"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "IJulia.image_png"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This expression $\\sqrt{3x-1}+(1+x)^2$ is an example of a TeX inline equation in a [Markdown-formatted](http://daringfireball.net/projects/markdown/) sentence."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Typesetting%20Equations.html\n",
    "\n",
    "\\begin{equation*}\n",
    "\\mathbf{V}_1 \\times \\mathbf{V}_2 =  \\begin{vmatrix}\n",
    "\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
    "\\frac{\\partial X}{\\partial u} &  \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
    "\\frac{\\partial X}{\\partial v} &  \\frac{\\partial Y}{\\partial v} & 0\n",
    "\\end{vmatrix}\n",
    "\\end{equation*} "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(\"/Users/utensil/.julia/v0.4/IJulia/src/inline.jl\",53)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(src, loc) = functionloc(display, ())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "module IPythonDisplay\n",
      "\n",
      "using IJulia, Compat\n",
      "import IJulia: send_ipython, publish, msg_pub, execute_msg,\n",
      "               metadata, display_dict, displayqueue, undisplay\n",
      "\n",
      "import Base: display, redisplay\n",
      "export display, redisplay, InlineDisplay, undisplay\n",
      "\n",
      "immutable InlineDisplay <: Display end\n",
      "\n",
      "# supported MIME types for inline display in IPython, in descending order\n",
      "# of preference (descending \"richness\")\n",
      "const ipy_mime = [ \"text/html\", \"text/latex\", \"image/svg+xml\", \"image/png\", \"image/jpeg\", \"text/plain\", \"text/markdown\" ]\n",
      "\n",
      "for mime in ipy_mime\n",
      "    @eval begin\n",
      "        function display(d::InlineDisplay, ::MIME{symbol($mime)}, x)\n",
      "            send_ipython(publish, \n",
      "                         msg_pub(execute_msg, \"display_data\",\n",
      "                                 @compat Dict(\"source\" => \"julia\", # optional\n",
      "                                  \"metadata\" => metadata(x), # optional\n",
      "                                  \"data\" => @compat Dict($mime => stringmime(MIME($mime), x)))))\n",
      "        end\n",
      "    end\n",
      "end\n",
      "\n",
      "# deal with annoying application/x-latex == text/latex synonyms\n",
      "display(d::InlineDisplay, m::MIME\"application/x-latex\", x) = display(d, MIME(\"text/latex\"), stringmime(m, x))\n",
      "\n",
      "# override display to send IPython a dictionary of all supported\n",
      "# output types, so that IPython can choose what to display.\n",
      "function display(d::InlineDisplay, x)\n",
      "    undisplay(x) # dequeue previous redisplay(x)\n",
      "    send_ipython(publish, \n",
      "                 msg_pub(execute_msg, \"display_data\",\n",
      "                         @compat Dict(\"source\" => \"julia\", # optional\n",
      "                                      \"metadata\" => metadata(x), # optional\n",
      "                                      \"data\" => display_dict(x))))\n",
      "end\n",
      "\n",
      "# we overload redisplay(d, x) to add x to a queue of objects to display,\n",
      "# with the actual display occuring when display() is called or when\n",
      "# an input cell has finished executing.\n",
      "\n",
      "function redisplay(d::InlineDisplay, x)\n",
      "    if !in(x,displayqueue)\n",
      "        push!(displayqueue, x)\n",
      "    end\n",
      "end\n",
      "\n",
      "function display()\n",
      "    q = copy(displayqueue)\n",
      "    empty!(displayqueue) # so that undisplay in display(x) is no-op\n",
      "    for x in q\n",
      "        display(x)\n",
      "    end\n",
      "end\n",
      "\n",
      "end # module\n"
     ]
    }
   ],
   "source": [
    "less(display, ())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "This expression $\\sqrt{3x-1}+(1+x)^2$ is an example of a TeX inline equation in a [Markdown-formatted](http://daringfireball.net/projects/markdown/) sentence.\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "IPythonDisplay.display(IJulia.text_markdown, \"\"\"\n",
    "This expression \\$\\\\sqrt{3x-1}+(1+x)^2\\$ is an example of a TeX inline equation in a [Markdown-formatted](http://daringfireball.net/projects/markdown/) sentence.\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "macro R_str(s)\n",
    "    s\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"This expression \\$\\\\sqrt{3x-1}+(1+x)^2\\$ is an example of a TeX inline equation in a [Markdown-formatted](http://daringfireball.net/projects/markdown/) sentence.\\n\""
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lx = R\"\"\"\n",
    "This expression $\\sqrt{3x-1}+(1+x)^2$ is an example of a TeX inline equation in a [Markdown-formatted](http://daringfireball.net/projects/markdown/) sentence.\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "This expression $\\sqrt{3x-1}+(1+x)^2$ is an example of a TeX inline equation in a [Markdown-formatted](http://daringfireball.net/projects/markdown/) sentence.\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "IPythonDisplay.display(IJulia.text_markdown, lx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "https://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Typesetting%20Equations.html\n",
       "\n",
       "\\begin{equation*}\n",
       "\\mathbf{V}_1 \\times \\mathbf{V}_2 =  \\begin{vmatrix}\n",
       "\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
       "\\frac{\\partial X}{\\partial u} &  \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
       "\\frac{\\partial X}{\\partial v} &  \\frac{\\partial Y}{\\partial v} & 0\n",
       "\\end{vmatrix}\n",
       "\\end{equation*} \n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "lx = R\"\"\"\n",
    "https://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Typesetting%20Equations.html\n",
    "\n",
    "\\begin{equation*}\n",
    "\\mathbf{V}_1 \\times \\mathbf{V}_2 =  \\begin{vmatrix}\n",
    "\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
    "\\frac{\\partial X}{\\partial u} &  \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
    "\\frac{\\partial X}{\\partial v} &  \\frac{\\partial Y}{\\partial v} & 0\n",
    "\\end{vmatrix}\n",
    "\\end{equation*} \n",
    "\"\"\"\n",
    "IPythonDisplay.display(IJulia.text_markdown, lx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "\\begin{equation*}\n",
       "\\mathbf{V}_1 \\times \\mathbf{V}_2 =  \\begin{vmatrix}\n",
       "\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
       "\\frac{\\partial X}{\\partial u} &  \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
       "\\frac{\\partial X}{\\partial v} &  \\frac{\\partial Y}{\\partial v} & 0\n",
       "\\end{vmatrix}\n",
       "\\end{equation*} \n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "lx = R\"\"\"\n",
    "\\begin{equation*}\n",
    "\\mathbf{V}_1 \\times \\mathbf{V}_2 =  \\begin{vmatrix}\n",
    "\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
    "\\frac{\\partial X}{\\partial u} &  \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
    "\\frac{\\partial X}{\\partial v} &  \\frac{\\partial Y}{\\partial v} & 0\n",
    "\\end{vmatrix}\n",
    "\\end{equation*} \n",
    "\"\"\"\n",
    "IPythonDisplay.display(IJulia.text_latex, lx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MIME type text/latex"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "IJulia.text_latex"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MIME{symbol(\"text/latex\")}"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "typeof(IJulia.text_latex)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MIME{symbol(\"text/latex\")}"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MIME{symbol(\"text/latex\")}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "\\begin{equation*}\n",
       "\\mathbf{V}_1 \\times \\mathbf{V}_2 =  \\begin{vmatrix}\n",
       "\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
       "\\frac{\\partial X}{\\partial u} &  \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
       "\\frac{\\partial X}{\\partial v} &  \\frac{\\partial Y}{\\partial v} & 0\n",
       "\\end{vmatrix}\n",
       "\\end{equation*} \n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "IPythonDisplay.display(MIME(symbol(\"text/latex\")), lx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "true"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinteractive()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 0.4.5",
   "language": "julia",
   "name": "julia-0.4"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "0.4.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
